<template>
  <div>
    <el-table v-loading="loading" :data="bookInfo">
      <el-table-column label="名称" align="center" prop="bookName" />
      <el-table-column label="排序" align="center" prop="bookIndex" sortable=""/>
      <el-table-column label="封面" align="center" prop="imgUrl" width="100">
        <template slot-scope="scope">
          <!-- <img :src="scope.row.imgUrl" alt="" :width="50" :height="50"> -->
          <image-preview :src="scope.row.imgUrl" :width="50" :height="50" />
        </template>
      </el-table-column>
      <el-table-column label="出版社" align="center" prop="publisher" />

      <!-- </el-table-column> -->

      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <!-- <el-button size="mini" type="text" icon="el-icon-edit" v-hasPermi="['system:bookinfo:edit']"
            @click="handleUpdate(scope.row)">修改
          </el-button> -->
          <el-button size="mini" type="text" icon="el-icon-delete" @click="delBookinfo(scope.row)"
            v-hasPermi="['system:bookinfo:remove']">移除
          </el-button>
        </template>
      </el-table-column>
    </el-table>



  </div>
</template>

<script>
import { delBookinfo, getBookinfo } from "../../../api/system/bookinfo";
export default {
  name: 'book',
  data() {
    return {
      bookInfo: []
    }
  },
  created() {
    this.bookInfo = JSON.parse(localStorage.getItem('bookInfo'))
  },
  methods: {

    delBookinfo(row) {
     
      if (row.id === undefined) {
        return
      }
      delBookinfo(row.id).then(res => {
        if (res.code == 200) {
       
          // this.bookInfo
          this.getBookinfo(this.bookInfo)
        }
      })
    }
  },
}
</script>

<style></style>